package cn.kgcnews.utils;

import java.io.File;

import javax.mail.Session;

public class Test {
	public static void main(String[] args) throws Exception{
		//1. 得到session
        Session session = MailUtils.createSession("smtp.163.com", "sendkgc@163.com", "kgc12345678");
        //2. 创建邮件对象
        Mail mail = new Mail("sendkgc@163.com","1751118779@qq.com","测试邮件2", "薛倩倩同学你好");
        //创建两个附件对象
        AttachBean ab1 = new AttachBean(new File("d:/药店.doc"), "药店.doc");
        //AttachBean ab2 = new AttachBean(new File("F:/big.jpg"), "衣服.jpg");
        // 添加到mail中
        mail.addAttach(ab1);
        //mail.addAttach(ab2);
        //3. 发送
        MailUtils.send(session, mail);
        System.out.println("发送成功");
	}
	
}
